package com.yuntsg.nnsfcp.controller;


import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@Controller
@Slf4j
public class IndexController {

    @Resource
    HttpServletRequest request;


    @GetMapping("/login")
    public void redirect(HttpServletResponse response) throws IOException {
        response.sendRedirect("src/views/user/login.html");
    }


    @SneakyThrows
    @GetMapping("/")
    public String homePage() {
        StringBuffer requestURL = request.getRequestURL();
        String string = requestURL.toString();
        log.error("请求地址++" + string);
//        if (!string.equals("http://gzycx.yuntsg.com/")) {
//            response.sendRedirect("https://gzycx.yuntsg.com/");
//        }
        return "index.html";
    }


}
